package com.example.javamaday.leetcode;

import com.example.javamaday.leetcode.base.ListNode;

public class LeetCodeTest0083 {

    public static void main(String[] args) {

    }

    public ListNode deleteDuplicates(ListNode head) {

        if (head == null || head.next == null) {
            return head;
        }

        ListNode curNode = head;

        while (curNode != null && curNode.next != null) {
            if (curNode.next.val == curNode.val) {
                curNode.next = curNode.next.next;
            } else {
                curNode = curNode.next;
            }
        }

        return head;
    }

}
